# 第一阶段下载源码包
FROM alpine:latest AS builder

ENV URL=https://gitee.com/Discuz/DiscuzX/attach_files/2044572/download

RUN apk add --no-cache wget unzip && \
    wget $URL -O /tmp/discuz.zip && \
    unzip /tmp/discuz.zip -d /tmp/discuz

# 第二阶段构建镜像
FROM webdevops/php-nginx:8.2-alpine

WORKDIR /app

COPY --from=builder /tmp/discuz/upload /app

RUN chown -R www-data:www-data /app && \
    chmod -R 775 /app && \
    chmod -R 777 /app/config /app/data /app/uc_client /app/uc_server

EXPOSE 80

USER www-data

CMD ["supervisord"]